package com.itheima.stream;

import java.util.*;

public class StreamDemo1 {
    public static void main(String[] args) {
        //单列集合调用stream流
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"aaa","bbb","ccc","ddd");
        list.stream().forEach(s -> System.out.println(s));

        //双列集合调用stream流（不能直接调用）
        HashMap<String,Integer> hm = new HashMap<>();
        hm.put("a",1);
        hm.put("b",1);
        hm.put("c",1);
        hm.put("d",1);
        Set<String> set = hm.keySet();
        set.stream().forEach(s -> System.out.println(s));

        Set<Map.Entry<String, Integer>> entries = hm.entrySet();
        entries.stream().forEach(s-> System.out.println(s));

        //数组调用stream流
        String[] arr = {"1","12","123"};
        int[] arr1={1,2,3,4,5};
        Arrays.stream(arr1).forEach(s -> System.out.println(s));




    }
}
